﻿using System;
using System.IO;
using Cashbook.Services;
using SQLite;

[assembly: Xamarin.Forms.Dependency(typeof(Cashbook.iOS.DatabaseConnection_iOS))]
namespace Cashbook.iOS
{
	public class DatabaseConnection_iOS: IDatabaseConnection
	{
		public SQLiteConnection DbConnection()
		{
			var dbName = "Cashbooks.db3";
			string personalFolder =	Environment.GetFolderPath(Environment.SpecialFolder.Personal);
			string libraryFolder =  Path.Combine(personalFolder, "..", "Library");
			var path = Path.Combine(libraryFolder, dbName);
			return new SQLiteConnection(path);
		}
	}
}
